package com.util.yxy;
import java.sql.Connection;
import java.sql.DriverManager;
/**mysql数据库连接
 * @author 余襄元
 * @date 2023/2/27
 * @projectName 二期项目
 **/
public class Dbutil {
    private static String driver = "com.mysql.cj.jdbc.Driver";
    private static String url = "jdbc:mysql://localhost:3306/测试?serverTimezone=UTC&useSSL=false";
    private static String user = "root";
    private static String pass = "root";
    public static Connection getConnection(){
        try {
            Class.forName(driver);
            return DriverManager.getConnection(url,user,pass);
        } catch (Exception e) {
            System.out.println("数据量连接异常1");
        }
        return null;
    }
    public  Connection  getConnection2(){
        try {
            Class.forName(driver);
            return DriverManager.getConnection(url,user,pass);
        } catch (Exception e) {
            System.out.println("数据量连接异常");
        }
        return null;
    }
}
